#ifndef M_HL10_H
#define M_HL10_H

/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_hal.h"

/* define ------------------------------------------------------------*/
#define MHL10_CONFIG_RETRY_NUMBER	2

/* function prototypes -----------------------------------------------*/
int string_to_hex(char *str, unsigned char *out, int outlen);

uint8_t mhl10_detect_bd(void);

uint8_t mhl10_set_bd(uint32_t bd);

uint8_t mhl10_set_freq(uint8_t type, uint32_t freq);

uint8_t mhl10_set_net(uint8_t net);

uint8_t mhl10_set_bw(uint8_t bw);

uint8_t mhl10_set_sf(uint8_t type,uint8_t sf);

uint8_t mhl10_set_riq(uint8_t type,uint8_t riq);

uint8_t mhl10_get_addr(uint32_t* addr);

uint8_t mhl10_get_freq(uint8_t type, uint32_t* freq);

uint8_t mhl10_get_sf(uint8_t type, uint8_t* sf);

uint8_t mhl10_get_bw(uint8_t* bw);

uint8_t mhl10_get_cfg(void);

uint8_t mhl10_get_rst_info(void);

uint8_t mhl10_send(uint8_t* buf, uint16_t size);

uint8_t mhl10_enter_sleep(void);

uint8_t mhl10_wake_up(void);

void mhl10_init(void);

#endif
